
#Remove?

SET(TRI_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
SET(TRI_CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")


IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")
	SET(TRI_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
	SET(TRI_CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
ENDIF()

ExternalProject_Add( TRIANGLE
	URL ${CMAKE_CURRENT_SOURCE_DIR}/Triangle-45799df8abb0.zip
	DOWNLOAD_EXTRACT_TIMESTAMP TRUE
	CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
		-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
		-DCMAKE_CXX_FLAGS=${TRI_CMAKE_CXX_FLAGS}
		-DCMAKE_C_FLAGS=${TRI_CMAKE_C_FLAGS}
		-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
		-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
		-DTRIANGLE_ENABLE_ACUTE=OFF
		-DBUILD_SHARED_LIBS=OFF
		-DBUILD_TESTING=OFF
)
ExternalProject_Get_Property( TRIANGLE INSTALL_DIR )
SET( TRIANGLE_INSTALL_DIR ${INSTALL_DIR} )
